import { losChannel } from "db://assets/app/Script/SDK/losChannel"
import { ccclass, BaseUI, EUILayer, _scene, _ui, winSize, TweenHelper, ETweenType, _platform } from "../../../main/script/Main"
import { CubeItem } from "../CubeItem"
import loskc from "db://assets/app/Script/SDK/loskc"


@ccclass("TipClickUI")
export class TipClickUI extends BaseUI {
	public layerType = EUILayer.Notice

	public _openData: number = null!

	private get item() { return this.getCacheComponent(CubeItem) }


	protected onOpen(): void {

		this.item.init(this._openData, false)

		_platform._nativeTemp_.showRoot()
		losChannel.instance().doAction(1, ['vivo', 'vivo1', 'oppo', 'xiaomi', 'oppo1'], (enabled, val) => {
			if (enabled) {
				const channelName = losChannel.instance().channel
				if (channelName == 'vivo' || channelName == 'oppo' || channelName == 'vivo1' || channelName == 'oppo1')
					losChannel.instance().showCustomAd(false, { top: losChannel.instance().getSysInfo().windowHeight / 2 - 300 })
				else if (channelName == 'xiaomi') {
					losChannel.instance().showCustomAd(false, { top: losChannel.instance().getSysInfo().windowHeight / 2 - 500 })
				}
			}
		})
		losChannel.instance().doAction(2, ['ks', 'ks2', 'ks3']);
		losChannel.instance().doAction(2, ['hw', 'honor'], (enabled, val) => {
			if (enabled && loskc.chance(val / 100)) {
				losChannel.instance().showCustomAd();
			}
		})
	}
}